/*
 * SignatureRegister.h
 *
 *  Created on: Nov 20, 2012
 *      Author: Federico Orquera
 */

#ifndef SIGNATUREREGISTER_H_
#define SIGNATUREREGISTER_H_

#include <bitset>

namespace SignatureSlicingIndex
{
	template <size_t keyWords, typename ID>  class SignatureRegister {

	public:
		typedef std::bitset<keyWords>	Signature;
		typedef ID						RegisterID;

		SignatureRegister(const RegisterID &newRegisterID){
			initialize(newRegisterID);
		}

		SignatureRegister(const RegisterID &newRegisterID, const Signature &newSignature){
			initialize(newRegisterID, newSignature);
		}

		virtual ~SignatureRegister(){}

		PhraseID getID() const {
			return this->registerID;
		}

		Signature& getSignature() {
			return this->signature;
		}

		void setSignature(const Signature& newSignature){
			this->signature = newSignature;
		}

		size_t size() const {
			return keyWords;
		}

	private:
		RegisterID registerID;	// ID de bloque
		Signature  signature;	// Persistir

		void initialize (const RegisterID &newRegisterID = 0, const Signature &newSignature = Signature() ){
			this->setID(newRegisterID);
			this->setSignature(newSignature);
		}

		void setID(const RegisterID &newRegisterID){
			this->registerID = newRegisterID;
		}
	};


}

#endif /* SIGNATUREREGISTER_H_ */
